<?php
namespace Home\Controller;
use Common\Model\ArticleModel;
use Common\Model\SettingModel;
use Common\Model\SlideModel;

class IndexController extends BaseController {
    /**
     * 首页
     */
    public function index()
    {
        $article_model = new ArticleModel();
        $category = C('ARTICLE.category');
        //公司风采
        list($elegant, $tmp) = $article_model->getArticleByCategory($category['elegant'], 6);
        //置顶新闻
        $top = $article_model->getTop();

        //企业新闻
        list($company, $tmp) = $article_model->getArticleByCategory($category['company'], 3);
        //视频新闻
        list($video, $tmp) = $article_model->getArticleByCategory($category['video'], 3);
        //媒体新闻
        list($media, $tmp) = $article_model->getArticleByCategory($category['media'], 3);

        $setting_model = new SettingModel();
        //首页视频
        $home_video = $setting_model->getSetting('home_video');
        $home_video_thumb = $setting_model->getSetting('home_video_thumb');

        //轮播
        $slide = (new SlideModel())->getSlide(1);

        $this->assign('companyPage', $setting_model->getPageInfo('company'));
        $this->assign('home_video', $home_video);
        $this->assign('home_video_thumb', $home_video_thumb);
        $this->assign('slide', $slide);
        $this->assign('elegant', $elegant);
        $this->assign('top', $top);
        $this->assign('company', $company);
        $this->assign('video', $video);
        $this->assign('media', $media);
        $this->display();
    }

    /**
     *法律声明
     */
    public function law()
    {
        $model = new SettingModel();
        $this->assign('info', $model->getPageInfo(ACTION_NAME));
        $this->display();
    }

    /**
     *站点地图
     */
    public function page()
    {
        $page = I('page');

        $this->assign('page', $page);
        $this->assign('pages', C('WEBSITE.page'));
        $this->display();
    }

    /**
     *公司风采
     */
    public function elegant()
    {

        $this->display();
    }

    /**
     *联系我们
     */
    public function contact()
    {
        $model = new SettingModel();
        $this->assign('info', $model->getPageInfo(ACTION_NAME));
        $this->display();
    }

    /**
     *站点地图
     */
    public function map()
    {
        $this->display();
    }

}